﻿////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// <copyright>Copyright 2008-2011 Andreas Huber Doenni</copyright>
// Distributed under the GNU General Public License version 2 (GPLv2).
// See accompanying file License.txt or copy at http://phuse.codeplex.com/license.
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

namespace Phuse.Mime
{
    using System;

    /// <summary>Implements the common functionality for all <see cref="HeaderField"/> subclasses.</summary>
    /// <typeparam name="TMostDerived">The most-derived subclass of this type.</typeparam>
    /// <threadsafety static="true" instance="false"/>
    public abstract class HeaderField<TMostDerived> : HeaderField, IVisitable<TMostDerived, HeaderField>
        where TMostDerived : HeaderField<TMostDerived>
    {
        /// <summary>See <see cref="IVisitable{T}.Accept"/>.</summary>
        public sealed override void Accept(IVisitor<HeaderField> visitor)
        {
            VisitableHelper.Accept(this, visitor);
        }

        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>Initializes a new instance of the <see cref="HeaderField{TMostDerived}"/> class.</summary>
        /// <param name="name">The name of the header field, e.g. "X-Newsreader".</param>
        /// <exception cref="ArgumentException"><paramref name="name"/> is <c>null</c> or empty.</exception>
        protected HeaderField(string name) : base(name)
        {
        }
    }
}
